home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PRINTER
/
MERGIT21.ARJ
/
MERGEIT.DOC
< prev
next >
Wrap
Text File
|
1992-02-22
|
56KB
|
988 lines
10 Feb '92
DOCUMENTATION FOR MERGING HAND SCANNER IMAGES WRITTEN TO PCX FILES
Hand image scanners have become inexpensive and popular in the last few years
for capturing printed images to computer graphic files. Typically the scanners
can capture an image 3"-4" wide. MergeIt (TM) is designed to align and merge
adjacent images captured with a hand scanner into PCX format files when the
original printed image is greater than 3"-4". Images larger than a legal sized
sheet (8.5"x14") may be captured into a single file with MergeIt.
By making a simple frame + edge guide to scan images with, you can most easily
automatically merge scanned sections of a document which are in the "PCX"
image file format. Manual merging of hand scanner images is also possible.
A number of user tools are available to effect a satisfactory alignment
and merge.
The program MergeIt (TM) can merge scanned images together which are
horizontally adjacent image sections. The actual merging, however, may be done
horizontally or vertically-resulting in a composite image with a landscape or
portrait orientation respectively. The composite image is displayed as it is
built, enabling progressive user trimming in the critical merged regions.
With both automatic or manual merging, automatic trimming is available to
correct small registration errors inherent in the hand image scanning process.
This appears as a drift in alignment across merged image regions.
Whole letter or legal sized page images can be built from hand scanned
sections that are very nearly indistinguishable from the whole page
flat-bed scanners.
MergeIt will display the merged image regions on Hercules, EGA, and VGA video
systems.
The automatic merge process will be most successful if a mechanical straight
edge is used on the left side to guide the hand scanner. In particular, any
twisting of the scanner will distort the image in ways that no software can
correct. With a modest amount of preparation, MergeIt will make full page
documents that are readily faxable or importable into painting and drawing
programs that use the PCX format.
The shareware version of MergeIt is limited to merging 2 image sections
and the merged output image file is named "ImageOut.PCX".
The registered version of MergeIt will merge up to 5 image sections and
does not restrict the output file name. See "Register.Txt".
Scanning SetUp-Physical Orientation
*** See "Frame.Doc" for more information on building a scanning frame. ***
In this documentation, scanned image sections will be described as being
generated by moving your hand scanner from the top to the bottom of a frame
which holds the image being scanned. Adjacent image sections are left and
right of each other (NOT above and below). Merging occurs along the vertical
edges of adjacent sections. Image section #1 is on the right.
Original Image To Scan
_________________________________ Scan in vertical
| ......... . .. . | columns, from
| . . . . . | top to
| . . . | |
| . . . . | \|/
| ......... . . . | bottom
---------------------------------
____________ ___________ ___________
| ......... | M | . . | M | . . |
| . | E | . . | E | . . |
| . | -> R <- | . | -> R <- | . |
| . | G | . | G | . . |
| ......... | E | . | E | . . |
-------------- ------------- -------------
Image 3 Image 2 Image 1
The image may be in a portrait or landscape orientation. Reference blocks (see
next section) are at the top edge of the image, the regions to be cut and
merged are at the left and right sides of the scanned image. The top and
bottom image edges just need to be cut. The image is scanned right to left,
with the scanned image file numbering starting on the right. (If the image
scanned is an ordinary sheet of text laid on its side in landscape
orientation, the top of the text should be on the right). MergeIt works with
B&W PCX files-if your hand scanner can make gray scale PCX files, then make
sure to set it to the B&W mode (sometimes called the line art or high
contrast setting).
Automatic merging of scanned image sections is dependent on the detection and
measurement of black reference blocks on the top edge of the scanned image
sections, just above the printed image to be merged, and within 1.5" of the
left and right edges. These black blocks must exist on a white background to
enable clean detection. "Frame.Doc" gives more information on how to set this
up.
Using MergeIt becomes more natural with a little practice. Since it is an
unusual mixture of mechanical setup and software, give yourself some time
to become fluent in adjusting and using it. The reward of having full sized,
merged images from almost any printed source for the modest cost of a hand
scanner (and MergeIt!) will make it worthwhile.
Enjoy!
Image Analysis for Locating Reference Blocks-Automatic Merging
The top 1.0" of the scanned image is analyzed for left and right reference
blocks within 1.5" of the left and right edges. The detected reference blocks
must have a minimum height of 0.1" to be valid. (See "Frame.Doc" for hints on
how to assure this). If a reference block height is insufficient, the
resultant merge will be unsatisfactory. This can be verified by running
MergeIt with the reference block analysis display feature on. (See Msec-Dbug
variable in the Initial Values File.)
During calculations, the bottom 0.01" of each block is ignored and the above
0.08" of the blocks are used to calculate critical left and right block edges
and block widths. The bottom 0.01" is skipped to avoid averaging spurious
partial block image lines.
Methods of Cutting and Merging the Vertical Left and Right Edges of Images
Each scanned image section has one line of parameters in the Initial Values
File which defines how to cut and merge it. (Initial Values File described
below).
The left edge of a scanned image is always processed the same way. The left
edge of the left top reference block acts as a vertical cutting line; the
image is cut with respect to this. The user may specify an offset from this
line. Even if no offset is desired, an entry in the Initial Values File
must be made (of "0.0").
The right vertical edge may be cut in one of three ways, specified in the
initial values file. The 1st non-zero entry (after the offset)
determines which method to use, starting with "a" below. If all 3 entries
are "0.0" then the third method will be used.
a) The simplest is a simple cut determined by a user-specified width with
respect to the left cut line. This cut is usually done for the right-most
scanned image since its right edge is also the edge of the document. In
this case, the width is specified as the 2nd entry on line 6 in the
initial values file.
b) The most commonly used automatic merge method is probably by reference
block merge. The method takes the width of the left reference index block
located in the image to the right and then utilizes the width of the right
block in the current image to calculate how to cut the right edge so that
the width of the merged block across the seam is equal to the original block
width (which is user specified). For each image section you wish to merge
this way, the reference block width is the 3rd entry on the corresponding
line in the initial values file.
c) The 3rd method is a mirror image of the way the left edge is cut. The
right edge of the right reference block determines a vertical cutting line.
The user may specify an offset from this. This method might be useful if
you have a page of text in narrow columns (such as a magazine). Using a right
white edge while scanning will cause a clean cut and merge of the adjacent
text columns. For each image section you wish to merge this way, the
offset is the 4th entry on the corresponding line in the initial values file.
Top and Bottom Cutting of Images
The top cutting line of an image is determined from the bottom edge of the
reference blocks. If one block is lower than the other, it determines the
edge.
The height of the cut image is user specified and is calculated in one of
two ways:
a) Ordinarily it calculated downwards from this top cutting line.
b) If the height is specified as a non-positive number, then the height
is interpreted as the dimension (in inches) to cut up from the bottom of
the rightmost scanned image section. The composite image height is then
the distance from the top cutting line to this shifted bottom line.
The additional scanned image sections to the left are cut to match
this height.
Command line switches (optional)
1) File name (with path if necessary) of initial values file. Ex:/image3.ini
2) Merged image filename to override the name specified in the initial values
file.
Ex: MergeIt /d:\paint\eschrB.ini /printA.pcx
Use the initial values file "eschrB.ini" in the directory "d:\paint"
and call the merged image file "printA.pcx".
Initial Values File
MergeIt requires an initial values file, written as a simple ascii text
file, to run. Since there are a number of sample initial values files included
to use with MergeIt, you need not understand all these parameters before
running MergeIt.
*** Before trying to understand these entries and their meaning, I ***
suggest you look at "Frame.Doc" (if you haven't already) for
a physical orientation on automatic merging.
In addition, you might want to see the line by line image
analysis described in the latter part of "Tutor.Txt".
You also might want to look at enclosed sample initial values files:
a) To automatically merge: EschrB.Ini
b) To manually merge: Manl50.Ini, Manl80.Ini, Manl-01.Ini, Eschr-01.Ini
Line by line description:
(line indices are for description only, do NOT include in actual file)
{Starting on line 5, all floating point numbers are inches,
+ is in the left direction when specifying left/right offsets, in the down
direction when specifying down/up offsets }
{spacing between numbers is not important-I space them in logical groupings}
1)Scan#.PCX {Scanned Image Filename, "#" denotes increment position
in name, scanned images move from right=>left}
2)1 3 {Index to start input files at, number of images to
merge i.e. scan1.pcx, scan2.pcx, scan3.pcx }
3)PageOut.PCX {Merged Image Filename to use}
4)25 12 0 1 3 {First 3 parameters affect automatic merging:
a) Dark Threshold (maximum % of dots that can be white
in the averaging of dot segments, in this case up to
3 out of 12 dots could be white),
b) Number of Dots to use in averaged dot segments,
a number <2.0 is interpreted as a dimension in
inches to average (and the appropriate number of
dots are calculated). If an odd number of dots is
specified, it is incremented to an even number.
Enter 0 to defeat automatic merging.
c) millisecs to view each line of analysis, called
Msec-Debug, see below}
{Next 2 parameters affect automatic trimming:
a) Alignment improvement threshold. Within each group
of 16-20 image lines being shifted along a merge
boundary, this threshold is the improvement
(in number of lines aligned) that must occur
for a shift to be implemented (instead of doing
no shifting). Typically set to 1. Setting to
a negative number will cause MergeIt to initialize
auto trimming but turn it OFF (which may be later
turned on by the user). In this case the threshold
value is the magnitude of the negative number
(i.e. without the negative sign).
Setting the threshold to 0 will prevent any auto
trimming.
b) Maximum rotated image alignment shift:
This value only affects auto trimming when the
user chooses to rotate the image as it is merged.
It defines the maximum shift along a merge boundary
that a group of 16 images lines will make in an
effort to improve alignment. Acceptable values
are 1 to 9. (Typically set to 3.)
Note that this value must be included even when
unrotated merging is to be performed.
5)0.0 8.4 4.0 3.5 General image cutting values:
{a) Top edge offset to trim down from for all image
sections,
b) height of outputted merged image,
(if < 0.0 then becomes the amount to cut up from
the bottom of the rightmost image section)
c) scanned image width,
d) spacing between reference blocks}
6)0.0 3.5 0.0 0.0 0.0
Values for cutting and merging the first scanned image
(the rightmost image):
{a) Inches to trim left image edge, with respect to
straight edge white/black boundary of left
reference block
b) Width to cut image at right edge. (If <0.0 then
this value becomes the amount to cut in from the
right edge of this image section.) If this value
is 0.0 then the program will cut the right edge
by the next method and value ("c")
c) Set right edge to merge with adjacent image on
the basis of total width of black index block which
is read here. The width is determined by the frame
setup you use. If this value is 0.0 then the program
will cut the right edge by the next method
and value ("d")
d) Cut right edge on the basis of the black/white
boundary. Use this number of inches to shift left/
right from boundary. This value may be 0.0
e) Top Line Offset for this image only. To be added to
global offset above.}
7)0.0 0.0 1.0 0.0 0.0
Values for cutting and merging the next scanned image
(to the left of the above image):
{a) Inches to trim left image edge, with respect to
straight edge white/black boundary
b) Width to cut image at right edge.(If <0.0 then
this value becomes the amount to cut in from the
right edge of this image section.) If 0.0 then
program will cut the right edge by the next
method and value ("c")..
c) Set right edge to merge with adjacent image on
the basis of total width of black index block which
is read. The total width is determined by the
frame setup you use. If 0.0 then program will
read next value..
d) Cut right edge on the basis of the black/white
boundary. Use this number of inches to shift left/
right from boundary. This value may be 0.0
e) Top Line Offset for this image only. To be added
to global offset on line 5.}
8)0.0 0.0 1.0 0.0 0.0
Values for cutting and merging the next scanned image
(to the left of the above image):
{a) Inches to trim left image edge, with respect to
straight edge white/black boundary
b) Width to cut image at right edge. (If <0.0 then
this value becomes the amount to cut in from the
right edge of this image section.) If 0.0 then
move on to (c)..
c) Set right edge to merge with adjacent image on
the basis of total width of black index block which
is read. Set value from frame setup. If 0.0
then move on to..
d) Cut right edge on the basis of the black/white
boundary. Use this number of inches to shift left/
right from boundary.
e) Top Line Offset for this image only. To be
added to global offset on line 5.}
Display of image line analysis (Msec-Debug):
The value of Msec-Debug determines how much reference block analysis
is displayed. If Msec value=1, then a summary of each image's analysis is
displayed after all lines in an image section are analyzed.
If Msec value is >1, then the individual line analysis
is shown for the # of Millisec specified in addition to the previous
information.
If Msec value=0, then only the actual image sections will be
displayed for user trimming. If Msec value is < 0, then image viewing and
user trimming will be bypassed. The image will be simply automatically
merged on the basis of the reference block analysis.
Error Messages When Running MergeIt
Errors may be divided into 3 groups: system, input and analysis, and cutting.
System: the program will halt
If there isn't enough memory to run the program (the program grows somewhat
in size as more images must be merged).
If an initial values file or image file is not found.
If there is no more disk space to store a combined image file.
Input and Analysis: the program will halt
If the initial values file has invalid numerical entries.
If the image files do not appear to be PCX files.
If the image files do not appear to be PCX hand scanner files, you will be
able to correct this. The most common scanner image file error is to not have
proper dot per inch (dpi) specifications. (The DFI scanner software seems to
do this.) For PCX files, there is a horizontal and a vertical dpi
specification. For a hand scanner image file, these two values should be equal
and a multiple of 100. When reading the first of a series of PCX files to
merge, if these two dpi specs are not equal then MergeIt will try to determine
which value is correct and display its choice to you. If the choice is correct
then press "enter" (<cr>), otherwise input the correct dpi value (as a whole
number) before <cr>. The remaining PCX files to merge will use this dpi value
if these files also don't have proper dpi specifications.
These reference block errors (if using automatic merging) will NOT cause
the program to halt:
One or both reference blocks may not be detected in the top left and right
regions that the program analyzes. The left block is always required for
determining the left vertical cutting line. The right block is not important
if vertical cutting method 1 is used. Analysis will be finished more quickly
if a right block is detected. If it is excluded in your scanning setup, an
erroneous region of the image may be detected as a reference block and the
image section will be cut down too much from the top.
The bottom edge of one or both reference blocks may never be reached within
the limits of the top region which program analyzes.
Cutting
After determining the desired boundaries for the cut image, including any user
offsets, the image available may be smaller than needed. This is most commonly
the case if a user offset extends a cutting edge beyond the image. The program
prompts you to approve cutting adjustments if image available is too small.
If you do not approve of the adjustment, the program will halt.
Special Input Image Considerations For Automatic Merging
Most documents to be scanned and merged will be on white/off-white paper and
will be easily distinguished by the program from the reference blocks. This
is necessary to determine the top edge of the cut image. If the document is
too dark, a plain white border of 1/16" or more may tacked to the top of the
document (perhaps by simply attaching a plain piece of paper to the back).
The user may then specify a top edge offset to obtain the desired cut image.
If the document to be scanned is a simple page of full width text, then
merging is straightforward.
If the images' edges to be merged just contain adjacent lines of text or text
and picture then you will probably get a very satisfactory merge the 1st time,
automatically, without any user trimming.
If you are attempting to merge a diagram or picture across image sections then
you may sometimes find the automatic merge to be unacceptable. The strength of
MergeIt is its absolute repeatability (if the same images and initial values
file are used) and its predictability if the initial values file is changed
with respect to user offsets. This allows you to make shifts in the merge
process down to the single dot/line level. By keeping a record of small trim
adjustments, you can make small corrections to the initial values file to
improve the automatic merge process. MergeIt can NOT automatically compensate
for the following scanned image error:
a) One image is rotated with respect to the other. This is usually caused
by twisting the scanner unit while scanning. It can be corrected by using
a left vertical guide edge. A lower guide bar may be attached to the
scanner handle if necessary. No software can correct this.
The following scanned image error can not be dealt with by the automatic
merging process but rather by use of the automatic trimming process:
b) One image is shorter than the other and gets misaligned. While moving
the scanner, the tracking roller on the bottom got stuck or skipped.
Perhaps there is some dirt on it that is changing its diameter (and
therefore possibly changing the apparent distance being scanned).
Perhaps you moved over the image too quickly and lost proper
registration. Typically hand scanners show a dot registration
variability as they roll of 1 or 2 dots/inch. The steadier and more
repeatable the image scanning stroke, the better. MergeIt allows you to
view the merge process, use automatic trimming and manually trim the
images to compensate for this.
*** I strongly suggest that you introduce yourself to trimming images by ***
making use of the tutorial. Read "Tutor.Txt".
If you are more inclined to 'figure it out as you go', at least please
read Quick StartUp in "Read.Me".
Manual Image Merging
If you wish to not use the reference blocks to automatically merge, set the
second parameter on line 4 of the initial values file=0 (# of dots to average
when determining reference block coordinates). Merging will be done at
the left extreme edge of each scanned section. The right edge of each merged
section may be cut as it is in automatic merging by the 2nd parameter on
the corresponding image parameter line (lines 6.. in the initial values file).
If this parameter is set to 0.0 then the full width of the scanned image will
be merged. Some sample manual merge initial values files are supplied.
"Manl50.ini" and "Manl80.ini" are for image sections 5.0" and 8.0" in height,
respectively. "Manl-01.ini" will merge varying height image sections by
calculating the height of the right image section after cutting 0.1" from
the bottom. They all merge image files named ImageA1.pcx and ImageA2.pcx.
To facilitate manual merging, it is important that the scanned image
sections have sufficient extra around the edges to allow you to move
sections to successfully merge. MergeIt always reserves at least 10 lines
from each input image's bottom to assure enough movement to accomplish a
merge. It is probably initially easier to manually merge an unrotated image
(the display matches the physical orientation used while scanning). For
unrotated merging, the height of each scanned image section should be
somewhat more than the desired height of the composite image to assure
enough upward movement. (Note that downward movement is not possible if a
merged section starts at the top of a scanned image file). The user does
have the option of performing upward movement past the lower edge of an
input image. A black area will be added to the composite image as necessary
to fill-in. This area may be removed from the composite by inserting lines
at the bottom of the composite when this region is displayed.
Manual merging of a rotated image is somewhat limited due to the need to
process rotated image regions. If the scanned image section is large enough,
then an extra border of up to 16 dots is included around the rotated image
region to merge. Therefore the maximum movement in any direction that includes
more of an image section in the composite image is never more than 16 dots.
If more movement is necessary, the rotated image region may be "pushed" left
or right 8 dots at a time. The "empty" image area is filled in by 1 of 3
methods: a) White dots b)Black dots c)Copy image edge adjacent to the area.
Of course, you can also manually insert/delete lines on the left edge of an
image to effectively move it to the right/left. Note that manual insert/delete
modifications will NOT be seen by the automatic trimming process (described
below).
VIEWING/TRIMMING MERGED EDGES
Generally:
Initial feedback of user trim commands is given through beeps. A single, short
medium pitched beep indicates more feedback is necessary to finish a user
trim operation. A double medium-high pitched beep indicates a completed
trim operation. All image trim commands may be repeated before the modified
image is processed and redisplayed. Entering a simple <cr> from the main menu
terminates the trimming process and starts redisplay and/or merging. The end
of user trimming and the restarting of image processing is signaled by a
triple beep. A longer, low-pitched single beep indicates an error or trim/
movement limit has been reached.
Global shifts of one scanned image with respect to another is accomplished
with the cursor keys. This movement is seen by the automatic trimming
process.
Internal scanned image adjustments (deleted/added lines and dots) are
initiated with the insert/delete keys. For unrotated merging, up to 50
insert/delete trim operations may be performed (and recalled if the merge
process is restarted midway thru) . More operations may be performed as
necessary if you are willing to erase the earliest ones. If rotated, up to
50 operations may be performed at each scanned image boundary between 2
images. In this case the operations are performed on the lower image (as
displayed on the screen). None of the user line insertion/deletion image
modifications are seen by the automatic trimming process.
Rotated Image Trim Process & User Commands
The top and bottom margins of each rotated & scanned image will be displayed.
100 image lines will be displayed for each margin (i.e. 200 lines will be
shown of each merged boundary area) and a short beep will sound
after each margin is fully displayed. At this time modifications are
possible.
Top Edge Merging:
The user can move the top edge of an image left or right up to 16 dots, image
permitting. Note that the width of the image is maintained so that the motion
limits may be less than 16 dots if the scanned image doesn't have this much
extra border width. Note that an image can also be moved to the right or left
by inserting or deleting lines at the left edge of the whole image. (This may
require moving the left displayed view to the left one or more times.) The
image to be merged may also be moved down by as much as 16 lines (again image
border permitting). Moving this image down will cause more of this image to be
included in the composite image. This image may also be moved up, cutting off
more of this image at the merge boundary. There is no limit to this upward
motion.
Top Edge User Commands:
Cursor Up/Down: Will subtract/add lines to the top of the current image
at the boundary with the previous image section's bottom edge.
Cursor Left/Right: Move the lower image left/right with respect to the above
(previous) image section edge.
'1'..'9': Set size of image movement performed by cursor keys. Size is in
number of lines or dots the lower image is shifted by each cursor
key entry. Program starts with a value=1.
<Insert> (<Delete>): Insert (delete) dots at the marker location for all
lines in the current displayed image section. A 2nd
menu will appear:
Command options:
Home/End: Move marker 1/8 of image width to the left/right.
SpaceBar: Move marker 1 dot to the right.
BkSpace : Move marker 1 dot to the left.
'+' : Make modification at marker location.
'-' : Remove modification at marker location (or the first modification
to the right of the marker).
<cr> Esc: Exit the insert/delete operation.
'L' : Remove the left most entry in the catagory chosen
'R' : Remove the right most entry in the catagory chosen
These 2 commands operate on both insert and delete entries (i.e. it does
not depend on which catagory you are in:
'U' : Remove all insert & delete entries from the currently viewed images.
'P' : Restore all insert & delete entries from the currently viewed images.
This reverses either user removal or automatic removal when a new
automatic merging process was initiated.
Cntl-Left/Right cursor (Hold down <Control> key while pressing cursor):
"Push" the image left/right (use this when you are at the movement limit
of the left/right cursor) by 8 dots. This is done by filling in the
necessary edge area by 1 of 3 methods:
a) Copy image edge to fill in area (default).
b) Fill area in white
c) Fill area in black
'F' : Select the method to fill-in when "pushing" the image left/right.
A 2nd menu will come up only if you are currently "pushing".
The top line will display which of 3 fill-in methods is being used.
Command options:
'W': Fill-in area with white dots
'B': Fill-in area with black dots
'C': Copy image edge to fill-in area.
'U': Undo image "pushing".
<Alt-V>: Change a viewed image region. A 2nd menu will appear.
2 user choices must follow:
Choose: Home/End=>Select which viewed region to shift.
Home is on the left, End is on the right.
Choose: Home/End=>Move the selected view region to the adjacent
left/right section of the image.
<Alt-T>: Change automatic trimming parameters. A 2nd menu will appear.
See below.
<cr> : Ends user input command and executes desired action/refreshes display.
'G' : Continue merge process without viewing (only operates if no image
modifications are done).
'H' : Toggle display of general help menu with auto trim status. When
starting MergeIt, default is to display whenever possible. Toggle will
cause general help menu to display only when an inappropriate key is
pressed, auto trim status only when an auto trim parameter is changed.
Bottom Edge Trimming:
The user may shorten the image up to 16 lines. The viewed areas of the image
may be shifted left or right. There MAY be a few image lines to add to the
initially viewed image. Essentially, trimming should be done to erase small
sections of text or picture at the bottom edge. It is NOT possible to shift
the bottom edge of the image left or right since the upper edge has already
been merged to the previous scanned image and most of this image has been
built. Once the next image is displayed below this edge, no more trimming at
this edge will be possible.
Bottom Edge User Commands:
Cursor Up/Down: Will subtract/add lines to the bottom of the image displayed
that will then be merged with the top edge of the next
section.
'1'..'9': Set size of image movement performed by cursor keys. Size is in
number of lines or dots the displayed image is shifted by each
cursor key entry. Program starts with a value=1.
<Alt-V>: Change a viewed image region. A 2nd menu will appear.
2 user choices must follow:
Choose: Home/End=>Select which viewed region to shift.
Home is on the left, End is on the right.
Choose: Home/End=>Move the selected view region to the adjacent
left/right section of the image.
<cr>: Ends user input command and executes desired action/refreshes display.
'G' : Continue merge process without viewing.
'H' : Toggle display of general help menu with auto trim status. When starting
MergeIt, default is to display whenever possible. Toggle will cause
general help menu to display only when an inappropriate key is pressed,
auto trim status only when an auto trim parameter is changed.
Unrotated Image Trim Process & User Commands
Each output image line is made up of image lines from all scanned sections.
Therefore some changes of image merging require that the merging process
restart from the beginning.
Initially, the right most 2 merge regions are shown, with the vertical
boundary between the sections centered. A marker is shown below the
right region, denoting the image on the right side of this merge region as the
image merge region that may be trimmed.
Home/End keys may be used to change the image section to be trimmed (home is
to the left). The cursor keys may be used to then move the selected region.
Note that the up/down cursor keys must shift the whole scanned region (which
may affect 2 merge boundaries). The left/right cursor keys only shift the
image at the edge that is selected (i.e. image dots are added or subtracted at
the border). The movement limits are determined by the limits of the scanned
images.
The viewed merge regions may be shifted left/right (if there are >3 input
image files) by use of the Alt-V key followed by home or end keys. Home will
shift the viewed regions 2 regions over to the left (or 1 if that is the max
shift). The end key will do likewise in the right direction.
Unrotated Image User Commands:
These four cursor commands will force a restart of the merge process. In
general you should reach the best whole image alignment as early as possible
in the merge process to eliminate having to restart merging.
Cursor Up/Down: Will shift the selected image section up/down.
While moving an image section up, you may reach the bottom limit of the
input image. A 2nd menu will pop up asking you if you wish to exceed the
limit. Doing so may add a black area to the bottom of the composite
image corresponding to this section. This can be removed by inserting
lines manually when you get to the bottom of the images in the merge
process.
Left/Right cursor:Move the selected image left/right with respect to the
selected merge boundary.
'1'..'9': Set size of image movement performed by cursor keys. Size is in
number of lines or dots the selected image section is shifted by
each cursor key entry. Program starts with a value=1.
Home/End: Select which viewed merge regions are modified. Home moves to the
left, End to the right.
<cr>: Ends user input and continues the merging process. If no user
modification is has been initiated on the currently displayed image
region, then the program proceeds to the next region. Otherwise,
the current region is redrawn or the merge process restarts at the
top (the latter occurs when whole image section motion is inputted
thru the cursor keys).
<Insert> (<Delete>): Will allow user to insert or (delete) individual lines
in an image region in view. The region to modify is
previously selected by home/end keys.
A 2nd menu will appear.
Command options:
PgUp/PgDn: Moves line change marker up/down 20 lines.
SpaceBar : Moves marker down 1 line.
BkSpace : Moves marker up 1 line.
'+' : Performs desired modification at marker location
'-' : Remove the chosen catagory of modification at the marker
(or the nearest modification below the marker)
<cr> <Esc>: Ends insert or delete process. Return to main menu.
'T' : Remove the top most (of current display) entry in the
catagory you are in (i.e. insert or delete)
'B' : Remove the bottom most (of current display) entry in the
catagory you are in.
These 3 commands operate on both insert and delete entries (i.e. it
does not depend on which catagory you are in):
'U': Remove all insert & delete entries from the currently viewed
images.
'P': Restore all insert & delete entries from the currently viewed
images. This reverses either user removal or automatic removal
when a new automatic merging process was initiated.
'S': If there is < 5 insert/delete entry spaces left, delete the 1st
entry (i.e. the 1 closest to the very top of the entire merged
image). As long as the affected region of the image is no longer
visible, this command will NOT affect the outputted image. Rather
it frees up modification entry space if you are running out when
you are near the bottom of a merged image. If you do restart the
merge process at the top, then the deleted entry and its
modification will be lost.
<Alt-V>: Change the merged regions shown. This command is only valid if more
than 2 merge regions exist. A 2nd menu will appear.
Choose: Home/End=>View merge regions to the left/right of the currently
viewed regions. If possible, two new regions will be
shown; otherwise, one new region will be shown in the
direction of shift (Home shifts left, End shifts
right).
<Alt-T>: Change automatic trimming parameters. A 2nd menu will appear.
See below.
'B' : Rebuild the entire merged image without viewing until the current
view region is reached. Useful if rebuilding is required by previous
trim commands.
'R' : Restart the merge process with full view, modification capability.
'G' : Continue the merge process without continuing to view or trim
(applicable only if no image modifications have just been made to
the viewed image).
'H' : Toggle display of general help menu with auto trim status. When
starting MergeIt, default is to display whenever possible. Toggle will
cause general help menu to display only when an inappropriate key is
pressed and auto trim status only when an auto trim parameter is
changed.
On-Line Menu Help
Appropriate user inputs are shown if the three files with extensions ".ras"
are located in the directory where MergeIt is. If the files are not present,
a low beep will sound when they are searched for (i.e. when a new menu would
be shown). Unless toggled off, whenever a merged image region is displayed,
the lower region of the screen will show appropriate input commands with the
bottom line showing the current automatic trimming status. If an appropriate
command is entered which activates a secondary series of commands, this new
menu will be displayed. Ending this secondary input process will bring the
general menu back. On the right side of the first line of the general menu
shows a "triangle symbol=#". This "#" is the size of the user image movement
produced by cursor key input. This movement is measured in dots or lines of
image shift.
The automatic trimming status line will change whenever the user causes a
parameter change in this process. The status line shows whether auto trimming
is ON, OFF, or disabled (never initialized). If auto trimming is ON or OFF,
then the layout of the full line will is:
AutoTrim :ON [2] Viewed Image Trim: Now[ 33] Redo NEW
^ ^ ^ ^
Status of Max line shift # of lines added/ Auto Trim will
Process when auto trimming deleted to image be redone
The trimming status of the currently viewed changeable image(s) may also
be "NO" if no auto trimming changes were made.
The trim status is also shown for what will happen if the current view
region is redisplayed. In addition to the On/Off states which are possible
for the current view, the "Redo" status may be NEW (if an auto trimming
reanalysis will be done on the currently viewed merge region). Auto trimming
reanalysis is automatically initiated by whole image movement by the user
(with the cursor keys).
Automatic Trimming Process
It is important to distingush auto trimming from auto merging. The latter is
alignment of adjacent whole scanned images by means of black reference blocks
located across merged regions on the top edge of each scanned image. Each
image is shifted as a whole with respect to an adjacent image.
In contrast, auto trimming attempts to compensate for the small, inevitable
errors in image registration as one moves a hand scanner across a piece of
paper. That is, over the course of a few inches of travel, only 198 lines may
be generated during the first inch, 203 lines during the next inch, etc.
When attempting to merge images, these errors will appear as varied
misalignment at the borders of merged image sections-even if the beginning
image edges are aligned. Auto trimming starts at the beginning of the image
and works down in groups of 16-20 image lines (about 0.1" at 200 dpi),
attempting to compensate for this mis-registration by inserting/deleting lines
as required to preserve alignment across the merged boundaries. MergeIt is
capable of performing up to 200 insert/delete line operations.
When auto trimming is performed on a displayed image region, any user
modifications of line insertion or deletion are surpressed when the image is
redrawn. These modifications may be restored through the insert/delete menu
option "P", but only if no additional insert/delete modifications are made
before the restoration.
Outline of automatic trimming process:
1) The process starts with the first 16-20 lines generated by the hand scanner
(top of an unrotated image, the left edge of a rotated image).
2) The initial alignment of black and white dots across boundaries is checked.
If it is perfect, nothing more is done.
3) If not perfect, the image line group (of 16-20 lines) is shifted along the
boundary, in one direction, one line at a time and a measure of how many
lines are aligned is made. Modification by inserting lines is tested first.
If an unrotated image is being merged, then up to two line shifts are made.
For a rotated image, the maximum shift is user specified from 1-9 lines. If
the best alignment found is better than no shifting by a user defined
number of lines, then this insertion of lines is done.
4) If the best alignment is not good enough, the shifting and alignment
measurement procedure is performed in the other direction, deletion. A
similar alignment criteria test is performed. If it also fails, then no
deletion of lines is performed.
5) The next 16-20 lines are selected and steps #2..#4 are performed. If
this is an unrotated image merge, then this process is repeated until the
next viewed image group of 200 lines is built and displayed.
For rotated merging, this process is repeated until the right edge of the
merged boundary is reached. Then the top 100 lines of the scanned image is
modified and displayed below the bottom edge of the previous image.
Control of auto trimming in Initial Values File (line#4, values 3 and 4):
Automatic trimming may be disabled when starting MergeIt by setting the
alignment threshold=0 in the initial values file. Merging will be speeded up
somewhat and a little less memory will be needed by MergeIt. BUT the user
will NOT be able to activate auto trimming.
Automatic trimming may be enabled by setting this threshold<>0. If it is <0,
then auto trimming will initially be turned OFF (but readily turned ON by
the user). A value >0 will turn auto trimming ON from the start.
The maximum line shift when doing rotated image merging must be specified
even if unrotated merging is chosen later. A typical value is 2-3. A high
value increases the possiblity of an erronous auto trim adjustment (see below
under hints). It may be set from 1-9.
User Commands:
When doing unrotated image merging, user input is possible when viewing a
merged region.
For rotated merging, user input is possible when the top edge of a rotated
image is in view (which is being merged and trimmed to the bottom edge of a
previous rotated image that is also in view).
From the general menu, <Alt-T> (i.e. alter trimming) will bring up a menu of
possible auto trimming commands. It is important to distingush between turning
auto trimming on/off and deleting/restores its effects on a viewed image.
The former only takes effect the NEXT time an auto trimming line analysis
is performed, the latter affects the implementation (and viewing) of the
results from the LAST auto trimming analysis. Initiating auto trim causes
the process to be performed (or reperformed) on the currently viewed image.
'Y' : Turn ON auto trim process (does NOT affect current view/images)
'N' : Turn OFF auto trim process (does NOT affect current view/images)
'I' : Initiate (or reinitiate) auto trim process on current display.
This will surpress any user insert/delete modifications. (These
modifications may be restored. See Insert/Delete commands above.)
If OFF, the auto trim process will be turned ON.
'U' : Eliminate present auto trim effects on currently displayed image
'P' : Restore present auto trim effects on currently displayed image
Esc <cr>: Do nothing (exit this auto trim input process)
For rotated merging process only:
'1'..'9': Choose max vert line shift while trimming each 16 line image
region (Note that the top of the 1st image is not merged so no
trimming is done but the parameters may still be changed).
If auto trimming is turned on, then the analysis is performed whenever a
new merged region is brought into view or whenever one image region is moved
as a WHOLE with respect to another region. Whole image movement is performed
with the cursor up/down and left/right keys.
Individual image line insertion/deletion by the user in the viewed images
does not cause an auto trimming reanalysis. (User line insertion/deletion
is not seen by the auto trim process). If a reanalysis is done after the
user does manual line insertion/deletion, these manual modifications are
initially surpressed in the rebuilt and displayed image. To restore the
manual insertion/deletions, after doing the reanalysis, go into the insert
or delete menu and enter "P" to restore previous entries. Note that you must
do this BEFORE adding new insert/delete entries.
Hints:
Auto trimming works best when there is continuing image lines running across
the merge boundaries. If many inches of scanned image boundaries are solid
black or white, then auto trim may not be able to make enough adjustment when
an edge is finally reached. In this case, it is probably best to use a rotated
image merge process and set the shift maximum high (erronous adjustments won't
be made in solid black or white regions anyway). Note that you can change this
maximum shift value as you move from one merge boundary to another if the
quality of the image at these boundaries is different. It is probably not a
good practice to set the maximum shift high all the time since this can lead
to large erroneous alignment adjustments. If an image has some cross boundary
detail every inch or so then a maximum shift of about 2-3 seems to work well.
When working with curved image lines/areas across boundaries, it is important
that adjacent scanned images have the correct amount of overlap (i.e. position
towards or away from each other) before trying to use auto trim to improve
alignment. (The tutorial demonstrates this when merging within an egg-like
object.)
If you are just merging scanned images from a typed page where you can put
your boundaries between typed lines, then disable auto trimming. Auto trimming
will do nothing with white boundary regions and just slow the merging process
down.
When doing rotated image merging, even though no auto trimming can be done at
the top edge of the first image, the user can still modify auto trim
parameters. In particular, when doing any manual merging it is probably best
to start with auto trimming enabled but off. This will enable manual alignment
between images without the confounding adjustments of auto trimming. After
arriving at a good positioning of adjacent images in the merge region where
the hand scanning started, (i.e. at the top of the screen for an unrotated
merged image or at the left side for a rotated one), turn on auto trim and
have it analyze the boundary region and make alignment adjustments.
Memory Issues
The program occupies about 140K bytes. A programming criterion was to be able
to handle a rotated merge of scanned image sections that are 4" wide and 9"
long at 300DPI in the 640K DOS space. This requires 405K bytes to store the
image to be rotated, which requires at least 545K bytes of free memory, not
an impossible goal. If the scanned images do not require rotation when
merging, then memory requirements are much less and won't be a concern. If
there is insufficient memory available for rotation, then you may specify
storage to disk (in the same directory as the other image files). For the
sake of time (and your hard disk!) I recommend you do this on a RAM disk.
First put the scanned images to be merged on the RAM disk before starting
MergeIt.
Normally, when MergeIt does a rotated merge, it stores the complete bottom
lines of each image (sections of which are viewed) so that the user may
change the merged sections being viewed even when the top of the next image
is being processed. If memory is tight, MergeIt may ask you if you want this
temporary storage to be done to disk. If you say "no", you will only be able
to change the merged sections to view when just the bottom edge of a scanned
image section is visible, i.e. once the top of the next image section is
visible, you can't change what regions you see.
Fatal Program Error Message Codes
2: File not found
3: DOS directory Path invalid
4: Too many files open. Perhaps the config.sys file doesn't specify enough
open files. Set to "Files=20".
5: File could not be opened, perhaps directory is full.
101: File could not be written to since the disk is full.
106: Numerical entry in initial values file is incorrect.
203: Insufficient memory to store image.
-3: Graphics error, driver file not found. Appropriate file (Herc.BGI,
EgaVga.BGI,...) is not in directory where executable program is located.
Integrating Scanning Operation and Merging (Registered users only)
ScanIt is a small shell program to integrate the scanning and merging process.
It executes the necessary image scanning utility to create the image
section files and then runs "MergeIt" to put the image sections together.
The process may be repeated for up to 100x, generating merged image files
with names such as page1.pcx,page2.pcx,...
While designed around the Logitech ScanMan DOS scanning utility, it was
written to be flexible enough for adaptation. It MUST be started in the
directory where itself and ALL executable files are located. The
initial values file may be in a different directory. The generated
image files may be stored in yet another directory.
For full documentation, see "ScanIt.Doc".
For the LogiTech Scanner, the DOS scan utility is called Scan.Exe
and is run from the DOS command line with a line such as:
Scan.Exe scan1.pcx 4IN 9IN
where the scanned image is written to the pcx format file "scan1.pcx"
with a width of 4 in. and a length of 9 in.
Typical Input Line for use with this scan utility
(best written in a batch file):
Scanit.exe Mergeit.exe /image3.ini Scan.exe [filename] [width]IN 9IN
The phrase "[filename]" is the location where ScanIt will place the scanned
image filename to be created by scan.exe. when it executes the utility.
The phrase "[width]" is the location where ScanIt will place the desired
width to scan (in inches) when it executes scan.exe.
Both of these entries are generated from the initial values file.
Typical Batch File:
cd D:\PAINT
D:
Scanit.exe mergeit.exe /e:\scan\image3.ini Scan.exe [filename] [width]IN 9IN
Legal Notices
MergeIt COPYR. 1991 Dennis DiBart ALL RIGHTS RESERVED
Disclaimer of Warranty:
This software and documentation are sold "as is" and without warranties as to
performance of merchantability or any other warranties whether expressed
or implied. Because of the various hardware and software environments
into which this program may be put, no warranty of fitness for a particular
purpose is offered.
Good data processing procedure dictates that any program be thoroughly
tested with non-critical data before relying on it. The user must assume
the entire risk of using the program. Any liability of the seller will be
limited exclusively to product replacement or refund of purchase price.